package com.cloud.api.domain.custom;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Objects;

/**
 * @author 杨斌
 * 2025-05-2025-05-20
 */
public enum AntennaStatusEnum implements IEnum<Short> {
    FAULT((short) 1, "故障"),
    NORMAL((short) 0, "正常");
    @EnumValue
    private final Short value;
    @JsonValue
    private final String desc;

    AntennaStatusEnum(Short value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Short getValue() {
        return value;
    }

    public static String getDesc(Short value) {
        for (AntennaStatusEnum status : values()) {
            if (Objects.equals(status.value, value)) {
                return status.desc;
            }
        }
        return "未知";
    }
    public static AntennaStatusEnum fromValue(Short value) {
        for (AntennaStatusEnum status : values()) {
            if (Objects.equals(status.value, value)) {
                return status;
            }
        }
        return null;
    }
}
